package com.webSite.demo.cy.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.webSite.demo.cy.bean.HomeContactUs;

@Mapper
public interface HomeContactUsMapper {

	@Select(value="select * from home_contact_us where state = 1")
	List<HomeContactUs> findAllInfo();
	
	@Insert(value="insert into home_contact_us(name, address, email, phone, state, created, updated) "
			+ "value(#{name},#{address},#{email},#{phone},#{state},#{created},#{updated})")
	int insertContactUs(HomeContactUs contact);
	
	@Select(value="select * from home_contact_us where id = #{0}")
	HomeContactUs selectOne(int id);
	
	@Update(value="update home_contact_us set name=#{name}, address=#{address}, email=#{email}, "
			+ "phone=#{phone}, updated=#{updated} where id=#{id}")
	int updateContactUs(HomeContactUs contact);
	
	/**
	 * 通过id来删除数据(虚拟删除)
	* @Title: updateState  
	* @param @param id 当参数为单个，或者不是对象的时候，应用占位符
	* @param @return    参数  
	* @return int    返回类型  
	* @throws
	 */
	@Update(value="update home_contact_us set state=0 where id = #{0}")
	int updateState(int id);
}
